<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>

  var countAndSay = function (n) {
    let regExp = /(\d)\1*/g
    if (n === 1) return '1'
    return countAndSay(n - 1).match(regExp).map(item => item.length + item[0]).join('')
  };
  console.log(arr());
</script>

</html>